<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>observe</title>
</head>
<body>
  <div id="app">
      <!-- <h2 :class="name" >方法{{count}}</h2> -->
   

    {{name}}

    <!-- <h1 id="h1">{{ name }}{{count}}</h1> -->
    <hr>
    <!-- <cpt :name="name">{{name}}</cpt> -->

    {{ count }}
    {{count2}}
    {{arr}}
    <h1 @click="an">按钮</h1>
  </div>

  <script src="../../dist/vue.js"></script>
  <script>
    var cpt = {
        props:{
          name:String
        },
      //必须要有一个根元素包裹 
      template: `
      <div>
      <h3 @click='change'>{{msg}}</h3>
      <h4>{{name}}</h4>
      </div>

      `
      }
    const vm = new Vue({
      el: '#app',
      data: {
        name: 'Hello Vue',
        count: 100,
        arr:[1,2,3,4,{a:987}]
      },
      mounted(){
        this.name = 'zyy'
      },
      methods:{
        an(){
          this.arr[4].a = 6655
        //   this.name = 'zyy'
        //  let h1 = document.getElementById("h1");
        //  h1.remove()
        //  document.body.append(`<b>{{name}}</b>`)
        }
      },
      components: {
            cpt
        },
      computed: {
          count2(){
            return this.count++
          }
        },
      watch:{
          count(newVal,oldVal){
            console.log(000);
          }
        }

    })
    vm.count = 999
  </script>
</body>
</html>